#!/bin/bash
readonly PROG='/sbin/apcaccess'
[[ -x "$PROG" ]] || exit 0
while read PARAM COLON VALUE UNIT; do
	for ARG in "$@"; do
		read NAME MAX <<< "$ARG";
		[[ "$PARAM" == "$NAME" ]] && echo "generic,g,apc-$NAME,0,$MAX,$VALUE"
	done
done < <($PROG)
